package executor.impl;

import executor.Executor;
import mapping.Configuration;
import mapping.MappedStatement;

import java.sql.Statement;

/*
 * @auther 顶风少年
 * @mail dfsn19970313@foxmail.com
 * @date 2020-01-08 17:18
 * @notify
 * @version 1.0
 */
public class CachingExecutor implements Executor {
    private Executor delegate = null;

    public CachingExecutor(Executor executor) {
        this.delegate = executor;
    }

    @Override
    public Object query(String statementId, Object param) throws Exception {
        //如果没有二级缓存，走1级缓存
        return delegate.query(statementId, param);
    }

    @Override
    public boolean insert() throws Exception {
        return delegate.insert();
    }
}
